package com.javabasic.algorithm.leetcode;

public class SymmetricTree {
    public boolean isSymmetric(TreeNode root) {
        if (root == null) return true;
        return executor(root.left,root.right);
    }

    public boolean executor(TreeNode left,TreeNode right) {
        if (left == null && right == null) return true;
        if (right == null || left == null) return false;
        if (right.val != left.val) return false;
        if (executor(right.right,left.left) && executor(right.left,left.right)) return true;
        return false;
    }
}
